#include <iostream>
using namespace std;
// 将基类的析构函数变成虚函数
class A{
    public: 
        A() {
            cout << "A::A()" << endl;
            aptr = new char[10];
        }
        ~A() {
            cout << "A::~A()" << endl;
            delete[] aptr;
        }
    private:
        char * aptr;    
};
class B{
    public:
        B() {
            cout << "B::B()" << endl;
            bptr = new char[10];
        }
        ~B() {
            cout << "B::~B()" << endl;
            delete[] bptr;
        }
    private:
        char * bptr;
        
};
int main(int argc, char const *argv[])
{
    /* code */
    return 0;
}
